package com.rd.student.jike.class5.wangxiangyang.kaoshi;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class StudentInformation {
    public static void main(String[] args) {
        try {
            BufferedWriter writer=new BufferedWriter(new FileWriter("Student.txt"));
            Scanner sc=new Scanner(System.in);
            for (int i = 1; i <= 3  ; i++) {
                System.out.println("第"+i+"个学生姓名");
                String name=sc.nextLine();
                System.out.println("第"+i+"个学生语文成绩");
                int chineseScore=sc.nextInt();
                System.out.println("第"+i+"个学生数学成绩");
                int mathScore=sc.nextInt();
                sc.nextLine();

                int totalSore=chineseScore+mathScore;
                writer.write(name+" "+chineseScore+" "+mathScore+" "+totalSore);
                writer.newLine();
            }
            writer.close();
            System.out.println("已录入");
        } catch (IOException e) {
            System.out.println("写入错误"+e.getMessage());
        }
    }

}
